/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mapping;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "software")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Software.findAll", query = "SELECT s FROM Software s"),
    @NamedQuery(name = "Software.findByIdSoft", query = "SELECT s FROM Software s WHERE s.idSoft = :idSoft"),
    @NamedQuery(name = "Software.findBySoft", query = "SELECT s FROM Software s WHERE s.soft = :soft"),
    @NamedQuery(name = "Software.findByDescripcion", query = "SELECT s FROM Software s WHERE s.descripcion = :descripcion")})
public class Software implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idSoft")
    private Integer idSoft;
    @Column(name = "soft")
    private String soft;
    @Column(name = "descripcion")
    private String descripcion;
    @JoinTable(name = "soft_disp", joinColumns = {
        @JoinColumn(name = "idSoft", referencedColumnName = "idSoft")}, inverseJoinColumns = {
        @JoinColumn(name = "idDisp", referencedColumnName = "idDisp")})
    @ManyToMany
    private Collection<Dispositivo> dispositivoCollection;

    public Software() {
    }

    public Software(Integer idSoft) {
        this.idSoft = idSoft;
    }

    public Integer getIdSoft() {
        return idSoft;
    }

    public void setIdSoft(Integer idSoft) {
        this.idSoft = idSoft;
    }

    public String getSoft() {
        return soft;
    }

    public void setSoft(String soft) {
        this.soft = soft;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public Collection<Dispositivo> getDispositivoCollection() {
        return dispositivoCollection;
    }

    public void setDispositivoCollection(Collection<Dispositivo> dispositivoCollection) {
        this.dispositivoCollection = dispositivoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSoft != null ? idSoft.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Software)) {
            return false;
        }
        Software other = (Software) object;
        if ((this.idSoft == null && other.idSoft != null) || (this.idSoft != null && !this.idSoft.equals(other.idSoft))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mapping.Software[ idSoft=" + idSoft + " ]";
    }
    
}
